<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   xmlns:pe="http://primefaces.org/ui"
   template="/WEB-INF/templates/business/buyer/template.xhtml">
   
   	<f:metadata>
	   	<f:viewParam name="bulletinId" value="#{bulletinHome3.id}"></f:viewParam>
	   	<f:event listener="#{bulletinHome3.initConversation()}" type="preRenderView"></f:event>
   	</f:metadata>
   	<ui:define name="buyer_head">
   		<style type="text/css">
   			.removeButton {
   				float: right;
   				margin-right: 20px;
   			}
   			.limitUnit{
   				margin-top:5px;
   			}
   			h2{
   				text-align:center
   			}
   			.rowStyle{
	   			text-align: center;
	   			font-size:16px
   			}
   			
   		</style>
   	</ui:define>
   	<ui:define name="buyer_content">
   
		<h:form id="editForm"  >         
			<p:panel id="panel" header="公告信息" style="margin-bottom:10px;">
		       <p:messages id="messages" closable="true"><p:autoUpdate/></p:messages>
		        <ui:include src="/WEB-INF/templates/business/bulletinBasicInfo.xhtml" />
			</p:panel>
		
				<p:panel id="bulletinReqs" header="公告要求">
				<h:panelGrid columns="2" cellpadding="5"
					columnClasses="column1,column2">
					<p:outputLabel for="rootQualificationGroup" value="匹配规则" />
					<h:outputText id="rootQualificationGroup"
						style="font-size:16px;color:red"
						value="#{bulletinHome3.instance.qualificationGroup.relation.typeName}" />
				</h:panelGrid>
				<p:panel id="agentServiceReqs" header="服务事项要求"
					rendered="#{bulletinHome3.instance.qualificationGroup.getAgentServiceGroups().size() > 0}"
					style="margin-bottom:10px;">
					<p:repeat var="_serviceGroup"
						value="#{bulletinHome3.instance.qualificationGroup.getAgentServiceGroups()}"
						varStatus="_groupStatus">
						<p:panelGrid cellpadding="5"
							style=" margin-bottom: 10px;width:100%">
							<p:row style="width:100%">
								<p:column>
									<h2>服务事项要求组#{_groupStatus.index +
										1}（#{_serviceGroup.relation.typeName}组）</h2>
								</p:column>
							</p:row>

							<p:row>
								<p:column>
									<p:panelGrid cellpadding="5" style="width:100%">
										<p:row styleClass="rowStyle">
											<p:column>服务事项名称</p:column>
											<p:column>对应资质大类</p:column>
										</p:row>

										<p:repeat var="_service"
											value="#{_serviceGroup.agentServices}">
											<p:row>
												<p:column>
													<h:outputText value="#{_service.name}" />
												</p:column>
												<p:column>
													<h:outputText value="#{_service.qualificationClass.name}" />
												</p:column>
											</p:row>
										</p:repeat>
									</p:panelGrid>
								</p:column>
							</p:row>
						</p:panelGrid>
					</p:repeat>
				</p:panel>

				<p:panel id="reqs" header="资质要求"
					rendered="#{bulletinHome3.instance.qualificationGroup.getQualificationGroups().size () > 0}"
					style="margin-bottom:10px;">
					<h:outputText
						value="#{bulletinHome3.instance.qualificationGroup.getQualificationGroupDetail()}" />
				</p:panel>

			</p:panel>
			
			<p:panel id="selecteSupplier" header="已选取的中介" rendered="#{not empty bulletinHome3.instance.successTrade}" style="margin-bottom:10px;">
					<p:outputLabel for="supplier" value="中介名称：" style="margin:5px 10px"></p:outputLabel>
					<h:outputText id="supplier" value="#{bulletinHome3.instance.successTrade.supplier.cnname}" />
					<p:outputLabel
						value="成交价(元)" rendered="#{bulletinHome3.instance.wayOfChoose eq 'Average' or bulletinHome3.instance.wayOfChoose eq 'Price'}"					
					/>
					<h:outputText rendered="#{bulletinHome3.instance.wayOfChoose eq 'Average' or bulletinHome3.instance.wayOfChoose eq 'Price'}"
						value="#{bulletinHome3.instance.agreedPrice}"
					/>
			</p:panel>
			<p:panel id="verifiedTrades" widgetVar="verifiedTrades" header="报名材料" style="margin-bottom:10px;" rendered="#{bulletinHome3.instance.defs.size() > 0}">
				<p:repeat var="_trade" value="#{bulletinHome3.instance.verifiedTrades}" varStatus="_status" style="margin:10px">
					<p:row style="display:inline-block;margin: 10px;" >
						<p:column >#{_status.index + 1}、#{_trade.supplier.cnname}</p:column>
						<p:column >
							<p:button outcome="ApplyCancel.xhtml" value="查看附件" style="margin-left:10px">
								<f:param name="tradeId" value="#{_trade.id}"></f:param>
								<f:param name="bulletinId" value="#{bulletinHome3.id}" ></f:param>
							</p:button>
						</p:column>
					</p:row>
					<br/>
				</p:repeat>
			</p:panel>

		</h:form>
		
		
   	</ui:define>
</ui:composition>
